<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        html,body{
            width: 100%;
            height: 100%;
            display: flex;
            justify-content: center;
            align-items: center;
            background-color: gray;
            z-index: -10;
        }
        .box{
            position: relative;
            width: 320px;
            height: 80px;
            border: 1px solid white;
            display: flex;
            justify-content: center;
            align-items: center;
            border-radius: 30px;
        }
        .box::after,
        .box::before{
            position: absolute;
            content: '';
            width: 30px;
            height: 30px;
            background-color: gray;
            z-index: 0;
        }
        .box::after{
            top: -10px;
            left: 20px;
            transition: all 0.5s ease-in-out;
        }
        .box::before{
            right: 20px;
            bottom: -10px;
            transition: all 0.5s ease-in-out;
        }
        .box:hover::after{
            left:270px
        }
        .box:hover::before{
            right:270px
        }
        .btn{
            overflow: hidden;
            box-sizing: content-box;
            width: 300px;
            height: 50px;
            display: flex;
            justify-content: center;
            align-items: center;
            position: absolute;
            border-radius: 30px;
        }
        .input{
            appearance: none;
            outline: none;
            box-sizing: border-box;
            border: none;
            text-indent: 20px;
            font-size: 20px;
            width: 100%;
            height: 100%;
            color: wheat;
            background-color: transparent;
            z-index:10;
        }
        .input:focus{
            color: gray;
        }
        .input:focus+.bg{
            background-color: #89ff00;
        }
        .bg{
            position: absolute;
            z-index:5;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: #512e5f;
            transition: all 0.5s ease-in-out;
        }

    </style>
</head>
<body>
<div class="box"><a class="btn">
    <input type="text" class="input" placeholder="请输入内容">
    <span class="bg"></span>
</a></div>
</body>
</html>
